package qsoft.omanga.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.List;

import qsoft.omanga.business.entities.Manga;
import qsoft.omanga.ui.custom.GalleryMangaHolder;

public class ImageAdapter extends BaseAdapter {
	/**
     * 
     */
	private Context context;
	/**
     * 
     */
	private List<Manga> list;

	/**
	 * 
	 * @param ctx
	 * @param list
	 */
	public ImageAdapter(Context ctx, List<Manga> list) {
		this.context = ctx;
		this.list = list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view;
		GalleryMangaHolder rowView = new GalleryMangaHolder(context,
        		list.get(position));
        view = rowView.getRow(convertView);
		return view;
	}
}
